package com.rfid.rfidbluetooth;

import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.rfid.base.base.BaseAdapter;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class RfidAdapter extends BaseAdapter<RfidAdapter.MyHolder,Rfid> {


    public RfidAdapter(List<Rfid> data) {
        super(data);
    }

    @Override
    protected int getLayout() {
        return R.layout.item_rfid;
    }

    @Override
    protected MyHolder getViewHolder(View view) {
        return new MyHolder(view);
    }

    @Override
    protected void bindView(MyHolder holder, int position, Rfid rfid) {
        holder.epc.setText("标签：" + rfid.getEpc());
//        holder.id.setText((position + 1) + "");
        holder.id.setText(rfid.getPort() + "");
        holder.ph.setText("盘号：" + rfid.getPh() + "");
    }

    class MyHolder extends RecyclerView.ViewHolder{
        @BindView(R.id.epc)
        TextView epc;
        @BindView(R.id.id)
        TextView id;
        @BindView(R.id.ph)
        TextView ph;
        public MyHolder(@NonNull  View itemView) {
            super(itemView);
            ButterKnife.bind(this,itemView);
        }
    }
}
